package com.leyou.auth.web;

import com.leyou.auth.service.ClientAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: YHL
 * @time: 2021/3/6 20:48
 */
@RestController
@RequestMapping("/client")
public class ClientAuthController {
    @Autowired
    private ClientAuthService clientAuthService;

    /**
     * 客户机请求auth 要阐述自己是谁 两个参数分别为clientId和secret
     * @param clientId
     * @param secret
     * @return
     */

    @GetMapping("/key")
    public ResponseEntity<String>getSecretKey(
            @RequestParam("clientId")String clientId,
            @RequestParam("secret")String secret){
        return ResponseEntity.ok(this.clientAuthService.getSecretKey(clientId,secret));
    }
}
